<!DOCTYPE html>
<html lang="en-us">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    
    <title>第八周作业Ⅰ | Bian&#39;s blog</title>
    <meta name="viewport" content="width=device-width,minimum-scale=1">
    <meta name="generator" content="Hugo 0.75.1" />
    
    
      <META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
    

    
    
      <link href="/homework/dist/css/app.4fc0b62e4b82c997bb0041217cd6b979.css" rel="stylesheet">
    

    

    
      

    

    
    
    <meta property="og:title" content="第八周作业Ⅰ" />
<meta property="og:description" content="1、阅读 Pseudocode Standard。（答案可以打印） 1）用伪代码描述将十进制转换成16进制的方法 FUNCTION Trans(num)a = num % 16IF num / 16 != 0 THENTrans(num/16)CASE a OF10:PRINTF &quot;A&quot;11:PRINTF &quot;B&quot;12:PRINTF &quot;C&quot;13:PRINTF &quot;D&quot;14:PRINTF &quot;E&quot;15:PRINTF &quot;F&quot;OTHERS:PRINT aENDCASEENDFUNCTIONMAINIF num &lt; 0 THENnum = -numPRINT &quot;-&quot;ENDIFTrans(num)ENDMAIN2）C语言实现（先用注释写好算法，然后翻译） #include&lt;stdio.h&gt;void Trans(int num) //FUNCTION Trans(num){int a = num % 16; //a = num % 16if(num/16 !" />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://Hugh488.gitee.io/homework/posts/the_eighth_week1/" />
<meta property="article:published_time" content="2020-10-27T15:33:11+08:00" />
<meta property="article:modified_time" content="2020-10-27T15:33:11+08:00" />
<meta itemprop="name" content="第八周作业Ⅰ">
<meta itemprop="description" content="1、阅读 Pseudocode Standard。（答案可以打印） 1）用伪代码描述将十进制转换成16进制的方法 FUNCTION Trans(num)a = num % 16IF num / 16 != 0 THENTrans(num/16)CASE a OF10:PRINTF &quot;A&quot;11:PRINTF &quot;B&quot;12:PRINTF &quot;C&quot;13:PRINTF &quot;D&quot;14:PRINTF &quot;E&quot;15:PRINTF &quot;F&quot;OTHERS:PRINT aENDCASEENDFUNCTIONMAINIF num &lt; 0 THENnum = -numPRINT &quot;-&quot;ENDIFTrans(num)ENDMAIN2）C语言实现（先用注释写好算法，然后翻译） #include&lt;stdio.h&gt;void Trans(int num) //FUNCTION Trans(num){int a = num % 16; //a = num % 16if(num/16 !">
<meta itemprop="datePublished" content="2020-10-27T15:33:11+08:00" />
<meta itemprop="dateModified" content="2020-10-27T15:33:11+08:00" />
<meta itemprop="wordCount" content="353">



<meta itemprop="keywords" content="" />
<meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="第八周作业Ⅰ"/>
<meta name="twitter:description" content="1、阅读 Pseudocode Standard。（答案可以打印） 1）用伪代码描述将十进制转换成16进制的方法 FUNCTION Trans(num)a = num % 16IF num / 16 != 0 THENTrans(num/16)CASE a OF10:PRINTF &quot;A&quot;11:PRINTF &quot;B&quot;12:PRINTF &quot;C&quot;13:PRINTF &quot;D&quot;14:PRINTF &quot;E&quot;15:PRINTF &quot;F&quot;OTHERS:PRINT aENDCASEENDFUNCTIONMAINIF num &lt; 0 THENnum = -numPRINT &quot;-&quot;ENDIFTrans(num)ENDMAIN2）C语言实现（先用注释写好算法，然后翻译） #include&lt;stdio.h&gt;void Trans(int num) //FUNCTION Trans(num){int a = num % 16; //a = num % 16if(num/16 !"/>

	
  </head>

  <body class="ma0 avenir bg-near-white">

    
   
  

  <header>
    <div class="bg-black">
      <nav class="pv3 ph3 ph4-ns" role="navigation">
  <div class="flex-l justify-between items-center center">
    <a href="/homework/" class="f3 fw2 hover-white no-underline white-90 dib">
      
        Bian&#39;s blog
      
    </a>
    <div class="flex-l items-center">
      

      
      















    </div>
  </div>
</nav>

    </div>
  </header>



    <main class="pb7" role="main">
      
  
  <article class="flex-l flex-wrap justify-between mw8 center ph3">
    <header class="mt4 w-100">
      <aside class="instapaper_ignoref b helvetica tracked">
          
        POSTS
      </aside>
      




  <div id="sharing" class="mt3">

    
    <a href="https://www.facebook.com/sharer.php?u=https://Hugh488.gitee.io/homework/posts/the_eighth_week1/" class="facebook no-underline" aria-label="share on Facebook">
      <svg height="32px"  style="enable-background:new 0 0 67 67;" version="1.1" viewBox="0 0 67 67" width="32px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M28.765,50.32h6.744V33.998h4.499l0.596-5.624h-5.095  l0.007-2.816c0-1.466,0.14-2.253,2.244-2.253h2.812V17.68h-4.5c-5.405,0-7.307,2.729-7.307,7.317v3.377h-3.369v5.625h3.369V50.32z   M33,64C16.432,64,3,50.569,3,34S16.432,4,33,4s30,13.431,30,30S49.568,64,33,64z" style="fill-rule:evenodd;clip-rule:evenodd;"/></svg>

    </a>

    
    
    <a href="https://twitter.com/share?url=https://Hugh488.gitee.io/homework/posts/the_eighth_week1/&amp;text=%e7%ac%ac%e5%85%ab%e5%91%a8%e4%bd%9c%e4%b8%9a%e2%85%a0" class="twitter no-underline" aria-label="share on Twitter">
      <svg height="32px"  style="enable-background:new 0 0 67 67;" version="1.1" viewBox="0 0 67 67" width="32px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M37.167,22.283c-2.619,0.953-4.274,3.411-4.086,6.101  l0.063,1.038l-1.048-0.127c-3.813-0.487-7.145-2.139-9.974-4.915l-1.383-1.377l-0.356,1.017c-0.754,2.267-0.272,4.661,1.299,6.271  c0.838,0.89,0.649,1.017-0.796,0.487c-0.503-0.169-0.943-0.296-0.985-0.233c-0.146,0.149,0.356,2.076,0.754,2.839  c0.545,1.06,1.655,2.097,2.871,2.712l1.027,0.487l-1.215,0.021c-1.173,0-1.215,0.021-1.089,0.467  c0.419,1.377,2.074,2.839,3.918,3.475l1.299,0.444l-1.131,0.678c-1.676,0.976-3.646,1.526-5.616,1.568  C19.775,43.256,19,43.341,19,43.405c0,0.211,2.557,1.397,4.044,1.864c4.463,1.377,9.765,0.783,13.746-1.568  c2.829-1.673,5.657-5,6.978-8.221c0.713-1.716,1.425-4.851,1.425-6.354c0-0.975,0.063-1.102,1.236-2.267  c0.692-0.678,1.341-1.419,1.467-1.631c0.21-0.403,0.188-0.403-0.88-0.043c-1.781,0.636-2.033,0.551-1.152-0.402  c0.649-0.678,1.425-1.907,1.425-2.267c0-0.063-0.314,0.042-0.671,0.233c-0.377,0.212-1.215,0.53-1.844,0.72l-1.131,0.361l-1.027-0.7  c-0.566-0.381-1.361-0.805-1.781-0.932C39.766,21.902,38.131,21.944,37.167,22.283z M33,64C16.432,64,3,50.569,3,34S16.432,4,33,4  s30,13.431,30,30S49.568,64,33,64z" style="fill-rule:evenodd;clip-rule:evenodd;fill:;"/></svg>

    </a>

    
    <a href="https://www.linkedin.com/shareArticle?mini=true&amp;url=https://Hugh488.gitee.io/homework/posts/the_eighth_week1/&amp;title=%e7%ac%ac%e5%85%ab%e5%91%a8%e4%bd%9c%e4%b8%9a%e2%85%a0" class="linkedin no-underline" aria-label="share on LinkedIn">
      <svg  height="32px"  style="enable-background:new 0 0 65 65;" version="1.1" viewBox="0 0 65 65" width="32px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  <path d="M50.837,48.137V36.425c0-6.275-3.35-9.195-7.816-9.195  c-3.604,0-5.219,1.983-6.119,3.374V27.71h-6.79c0.09,1.917,0,20.427,0,20.427h6.79V36.729c0-0.609,0.044-1.219,0.224-1.655  c0.49-1.22,1.607-2.483,3.482-2.483c2.458,0,3.44,1.873,3.44,4.618v10.929H50.837z M22.959,24.922c2.367,0,3.842-1.57,3.842-3.531  c-0.044-2.003-1.475-3.528-3.797-3.528s-3.841,1.524-3.841,3.528c0,1.961,1.474,3.531,3.753,3.531H22.959z M34,64  C17.432,64,4,50.568,4,34C4,17.431,17.432,4,34,4s30,13.431,30,30C64,50.568,50.568,64,34,64z M26.354,48.137V27.71h-6.789v20.427  H26.354z" style="fill-rule:evenodd;clip-rule:evenodd;fill:;"/>
</svg>

    </a>
  </div>


      <h1 class="f1 athelas mt3 mb1">第八周作业Ⅰ</h1>
      
      
      <time class="f6 mv4 dib tracked" datetime="2020-10-27T15:33:11+08:00">October 27, 2020</time>

      
      
    </header>
    <div class="nested-copy-line-height lh-copy serif f4 nested-links nested-img mid-gray pr4-l w-two-thirds-l"><h2 id="1阅读-pseudocode-standard答案可以打印">1、阅读 Pseudocode Standard。（答案可以打印）</h2>
<h3 id="1用伪代码描述将十进制转换成16进制的方法">1）用伪代码描述将十进制转换成16进制的方法</h3>
<pre><code>FUNCTION Trans(num)
    a = num % 16
    IF num / 16 != 0 THEN
        Trans(num/16)
    CASE a OF
            10:PRINTF &quot;A&quot;
            11:PRINTF &quot;B&quot;
            12:PRINTF &quot;C&quot;
            13:PRINTF &quot;D&quot;
            14:PRINTF &quot;E&quot;
            15:PRINTF &quot;F&quot;
            OTHERS:PRINT a
    ENDCASE
ENDFUNCTION

MAIN
    IF num &lt; 0 THEN
        num = -num
        PRINT &quot;-&quot;
    ENDIF
    Trans(num)
ENDMAIN
</code></pre><h3 id="2c语言实现先用注释写好算法然后翻译">2）C语言实现（先用注释写好算法，然后翻译）</h3>
<pre><code>#include&lt;stdio.h&gt;

void Trans(int num)         //FUNCTION Trans(num)
{
    int a = num % 16;       //a = num % 16
    if(num/16 != 0){        //IF num / 16 != 0 THEN
        Trans(num/16);      //Trans(num/16)
    }

    switch(a){              //CASE a OF
        case 10: printf(&quot;A&quot;); break;    //10:PRINTF &quot;A&quot;
        case 11: printf(&quot;B&quot;); break;    //11:PRINTF &quot;B&quot;
        case 12: printf(&quot;C&quot;); break;    //12:PRINTF &quot;C&quot;
        case 13: printf(&quot;D&quot;); break;    //13:PRINTF &quot;D&quot;
        case 14: printf(&quot;E&quot;); break;    //14:PRINTF &quot;E&quot;
        case 15: printf(&quot;F&quot;); break;    //15:PRINTF &quot;F&quot;
        default: printf(&quot;%d&quot;, a);break;    //OTHERS:PRINT a
    }       //ENDCASE
}       //ENDFUNCTION

int main()      //MAIN
{
    int num;
    scanf(&quot;%d&quot;, &amp;num);

    if(num &lt; 0){        //IF num &lt; 0 THEN
        num = -num;     //num = -num
        printf(&quot;-&quot;);    //PRINT &quot;-&quot;
    }                   //ENDIF
    Trans(num);         //Trans(num)
    return 0;
}       //ENDMAIN
</code></pre><h3 id="3使用--1-0-1-15-263265-最为输入测试你的程序">3）使用 -1, 0, 1, 15, 26，3265 最为输入测试你的程序</h3>
<p><img src="../pic/code.png" alt=""></p>
<h2 id="2名词解释与对比">2、名词解释与对比</h2>
<h3 id="1top-down-design">1）Top-down design</h3>
<p>A <strong>top-down</strong> approach (also known as stepwise design and in some cases used as a synonym of decomposition) is essentially the breaking down of a system to gain insight into its compositional sub-systems in a reverse engineering fashion.</p>
<h3 id="2-work-breakdown-structure-wbs">2） Work breakdown structure (WBS)</h3>
<p>A <strong>work breakdown</strong> structure (WBS), in project management and systems engineering, is a deliverable-oriented decomposition of a project into smaller components.</p>
<h3 id="3简述管理学-wbs-与-信息学top-down设计-的异同">3）简述管理学 WBS 与 信息学Top-down设计 的异同</h3>
<p>异：Top-down是从上到下，WBS根据不同类别分成小的部分。</p>
<p>同：都是将大系统分解为多个小系统解决。</p>
<h2 id="3仔细观察您洗衣机的运作过程运用top-down设计方法和pseudocode-描述洗衣机控制程序假设洗衣机可执行的基本操作如下">3、仔细观察您洗衣机的运作过程，运用Top-down设计方法和Pseudocode 描述洗衣机控制程序。假设洗衣机可执行的基本操作如下：</h2>
<h2 id="water_in_switchopen_close--open-打开上水开关close关闭">water_in_switch(open_close) // open 打开上水开关，close关闭</h2>
<h2 id="water_out_switchopen_close--open-打开排水开关close关闭">water_out_switch(open_close) // open 打开排水开关，close关闭</h2>
<h2 id="get_water_volume-返回洗衣机内部水的高度">get_water_volume() //返回洗衣机内部水的高度</h2>
<h2 id="motor_rundirection--电机转动left左转right右转stop停">motor_run(direction) // 电机转动。left左转，right右转，stop停</h2>
<h2 id="time_counter--返回当前时间计数以秒为单位">time_counter() // 返回当前时间计数，以秒为单位</h2>
<h2 id="haltreturncode-停机success-成功-failure-失败">halt(returncode) //停机，success 成功 failure 失败</h2>
<h3 id="1请使用伪代码分解正常洗衣程序的大步骤包括注水浸泡等">1）请使用伪代码分解“正常洗衣”程序的大步骤。包括注水、浸泡等</h3>
<h3 id="2进一步用基本操作控制语句ifforwhile等变量与表达式写出每个步骤的伪代码">2）进一步用基本操作、控制语句（IF、FOR、WHILE等）、变量与表达式，写出每个步骤的伪代码</h3>
<h3 id="3根据你的实践请分析正常洗衣与快速洗衣在用户目标和程序上的异同你认为是否存在改进创新空间简单说明你的改进意见">3）根据你的实践，请分析“正常洗衣”与“快速洗衣”在用户目标和程序上的异同。你认为是否存在改进（创新）空间，简单说明你的改进意见？</h3>
<h3 id="4通过步骤3提取一些共性功能模块函数简化正常洗衣程序使程序变得更利于人类理解和修改维护例如">4）通过步骤3），提取一些共性功能模块（函数），简化“正常洗衣”程序，使程序变得更利于人类理解和修改维护。例如：</h3>
<h3 id="waittime-等待指定的时间">wait(time) //等待指定的时间；</h3>
<h3 id="注水volumetimeout-在指定时间内完成注水否则停机">注水(volume,timeout) //在指定时间内完成注水，否则停机；</h3>
<h3 id="排水timeout-等子程序">排水(timeout)。 等子程序</h3>
<p>1）</p>
<pre><code>选择模式：洗衣模式，水位
注水：水位到设定水位
浸泡：浸泡时间
漂洗：电机转动，左右各三秒
排水：水位到0
脱水：电机转动
停机
</code></pre><p>2）</p>
<pre><code>READ(洗衣模式，水位)

WHILE 水位 &lt; 设定水位
    water_in_switch(open)
ENDWHILE
water_in_switch(close)

now = time_counter()
IF time_counter() &gt;= now+浸泡时间 THEN
    now = time_counter()
    WHILE time_counter() &lt; now+漂洗时间
        now1 = time_counter();
        motor_run(left)
        IF time_counter() == now1 + 3
            motor_run(right)
        ENDIF
    ENDWHILE
    motor_run(stop)

    WHILE get_water_volume() &gt; 0 
        water_out_switch(open)
    ENDWHILE

    now = time_counter()
    WHILE time_counter() &lt; now+脱水时间
        motor_run(left)
    ENDWHILE
    motor_run(stop)
    water_out_switch(close)

    halt(returncode)
ENDIF
</code></pre><p>3）</p>
<p>同：都是要洗衣服</p>
<p>异：快速洗衣不用浸泡</p>
<p>4）</p>
<p>pattern()   //选择模式</p>
<p>out_time(time) //脱水时间</p>
<ul class="pa0">
  
</ul>
<div class="mt6 instapaper_ignoref">
      
      
      </div>
    </div>

    <aside class="w-30-l mt6-l">




</aside>

  </article>

    </main>
    <footer class="bg-black bottom-0 w-100 pa3" role="contentinfo">
  <div class="flex justify-between">
  <a class="f4 fw4 hover-white no-underline white-70 dn dib-ns pv2 ph3" href="https://Hugh488.gitee.io/homework" >
    &copy;  Bian's blog 2020 
  </a>
    <div>














</div>
  </div>
</footer>

    

  <script src="/homework/dist/js/app.3fc0f988d21662902933.js"></script>


  </body>
</html>
